#include <iostream>
#include <vector>
#include <string>
using namespace std;


class Solution
{
public:
    int findNumberOfLIS(vector<int>& nums)
    {
        int n = nums.size();
        vector<int> maxLen(n, 1), count(n, 1);

        int retLen = 1, retCount = 1;
        for (int i = 1; i < n; i++)
        {
            for (int j = i - 1; j >= 0; j--)
            {
                if (nums[j] < nums[i])
                {
                    if (maxLen[j] + 1 > maxLen[i])
                        maxLen[i] = maxLen[j] + 1, count[i] = count[j];
                    else if (maxLen[j] + 1 == maxLen[i])
                        count[i] += count[j];
                }
            }
            if (maxLen[i] > retLen)
                retLen = maxLen[i], retCount = count[i];
            else if (maxLen[i] == retLen)
                retCount += count[i];
        }

        return retCount;
    }
};

void Test01()
{
    vector<int> nums = { 1,3,5,4,7 }, nums1 = { 2,2,2,2,2 };
    Solution s;
    cout << s.findNumberOfLIS(nums);
}


int main()
{
    Test01();
    return 0;
}